package com.ee.chat.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ee.chat.common.entity.SysPushMessage;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper接口
 * </p>
 *
 * @author Shane
 * @since 2019-10-22
 */
public interface SysPushMessageMapper extends BaseMapper<SysPushMessage> {
    /**
     * 获取最新的推送消息
     * @Author Shane
     * @Date 2020/1/30 23:31
     * @param
     * @return
     */
    SysPushMessage getNewestPushMessage(@Param("userId") Integer userId, @Param("host") Integer host);

    /**
     * 获取用户消息
     * @Author Shane
     * @Date 2019/10/22 23:15
     * @param
     * @return
     */
    IPage<SysPushMessage> getPushMessgae(Page page, @Param("userId") Integer userId, @Param("host") Integer host);

    /**
     * 获取未读消息数量
     * @Author Shane
     * @Date 2020/1/28 15:33
     * @param
     * @return
     */
    int getUserNotReadPushMessageCount(@Param("userId") Integer userId);

    /**
     * 更新消息读状态
     * @Author Shane
     * @Date 2020/1/28 15:33
     * @param
     * @return
     */
    int batchUpdateIsRead(@Param("ids") List<Integer> ids);

    IPage<SysPushMessage> list(Page page, @Param("keyword") String keyword);
}